﻿
#=========================配置项目信息=======================================

# 项目名称
PROJECT(BaseWidget LANGUAGES CXX)

# 设置生成动态库(默认静态库)
SET(BUILD_SHARED_LIBS ON)

# 定义DLL导出符号宏定义
ADD_DEFINITIONS("-DAPI_BaseWidget")

# 引入所有H文件和CPP文件
FILE(GLOB SRC_H_FILES "*.h")
FILE(GLOB SRC_CPP_FILES "*.cpp")
FILE(GLOB SRC_UI_FILES "*.ui")

# 将源代码添加到此项目的可执行文件
ADD_LIBRARY(${PROJECT_NAME} ${SRC_H_FILES} ${SRC_CPP_FILES} ${SRC_UI_FILES})

# 包含头文件目录
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 
    PRIVATE
	${CMAKE_SOURCE_DIR}
)

# 配置编译选项
IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
    SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
ENDIF()    



# =================引入外部依赖库==================

FIND_PACKAGE(Qt5 COMPONENTS Core Widgets REQUIRED)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} Qt5::Core Qt5::Widgets)

TARGET_LINK_DIRECTORIES(${PROJECT_NAME} PRIVATE ${PROJECT_OUTPUT_BIN_DIR})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} BaseModule)
ADD_DEPENDENCIES(${PROJECT_NAME} BaseModule)

# 链接外部其它模块




# ==================打印环境信息==================

# 打印项目路径
#MESSAGE( STATUS "{${PROJECT_NAME}} 项目目录 = ${PROJECT_SOURCE_DIR}" )
